{% extends 'base.html' %}
{% load static %}
{% block title %}测试集合结果统计{% endblock %}
{% block content %}
<body>
<p style="margin-left: 10px;"><span style="margin-left: 5px;">用例集合执行结果统计：成功 {{ success_num }} 次，失败 {{ fail_num }} 次</span></p>
<div id="main" style="width: 600px; height: 400px;margin-left: 10px;"></div>
<script type="text/javascript" src="{% static 'js/echarts.min.js' %}"></script>
<script>
    echarts.init( document.getElementById('main')).setOption({
        series:{
            type:'pie',
            color:['green','red'],
            data:[
                {name:'成功的次数',value:{{success_num}}},
                {name:'失败的次数',value: {{fail_num}},
            ]
        }
    });
    echarts.init(document.getElementById('main')).setOption({
      title:{
          text:'结果统计',
          subtext: '即时数据',
          left:'center'
      },
     tooltip:{
          trigger:'item'
    },
     legend:{
          orient:'vertical',
         left: 'left'

      },
    series:{
        name:'结果统计',
        radius:'55%',
        type: 'pie',
        color:['green','red'],
        data:[
            {name:'执行成功次数',value:{{success_num}}},
            {name:'执行失败次数',value: {{fail_num}}}
        ],
        label:{
        normal:{
            show:true,
            formatter:"{b}:{c} ({d}%)"
        }

    }
      }
    }
    );

</script>
<div class="table-responsive">
    <table class="table table-striped">
    <thead>
    <tr>
        <th>id</th>
        <th>测试集合名称</th>
        <th>延迟执行时间</th>
        <th>执行状态</th>
        <th>测试结果</th>
        <th>创建者</th>
        <th>创建时间</th>

    </tr>
    </thead>
    <tbody>
    {% for case_suite_record in case_suite_records %}
                        <td>{{suite_case.case_suite_record.case_suite.suite_desc}}</td>
                        <td>{{ suite_case.id }}</td>
                        <td><a href="{% url 'test_case_detail' suite_case.id%}">{{ suite_case.test_case.case_name }}</a></td>
                        <td>{{ suite_case.test_case.belong_project.name }}</td>
                        <td>{{ suite_case.test_case.belong_module.name }}</td>
                        <td>{{ suite_case.test_case.maintainer }}</td>
                        <td>{{ suite_case.test_case.created_time|date:"Y-n-d H:i" }}</td>
                        <td>{{ suite_case.test_case.updated_time|date:"Y-n-d H:i" }}</td>
                        <td>{{ suite_case.test_case.user }}</td>
                    </tr>
                    {% endfor %}
    </tbody>
    </table>
</div>
<div id="pages" class="text-center">
            <nav>
                <ul class="pagination">
                    <li class="step-links">
                        {% if suite_case_records.has_previous %}
                        <a class='active' href="?page={{ suite_case_records.previous_page_number }}">上一页</a>
                        {% endif %}

                        <span class="current">
                    第 {{ suite_case_records.number }} 页 / 共 {{ suite_case_records.paginator.num_pages }} 页</span>

                        {% if suite_case_records.has_next %}
                        <a class='active' href="?page={{ suite_case_records.next_page_number }}">下一页</a>
                        {% endif %}
                    </li>
                </ul>
            </nav>
        </div>
    </div>
</div>
</body>
{% endblock %}